class Jaunt < ActiveRecord::Base
  validates_presence_of :name, :description, :house_id, :start_time, :end_time
  
  belongs_to :house
  has_many :freshman_jaunts
  
  def currently_active
    if start_time < 1.hour.from_now and end_time > Time.now
     return true
    else
     return !(current_freshman_jaunts.empty?)
    end
  end
  
  def current_freshman_jaunts
    all_freshman_jaunts=freshman_jaunts.find(:all)
    these_jaunts = all_freshman_jaunts.find_all { |this_freshman_jaunt|
      this_freshman_jaunt.currently_active
    }
    return these_jaunts
  end
end
